package advance_2;

import java.util.Arrays;

public class RunTest {
    public static void main(String[] args) throws ClassNotFoundException {
        //Runtime构造方法是私有的,static getRuntime的方法,返回他的一个对象
        Runtime r1=Runtime.getRuntime();
        Runtime r2=Runtime.getRuntime();
        System.out.println(r1==r2);//单例

        //Obj.getInstance();
        System.out.println("cpu:"+r1.availableProcessors());
        System.out.println("内存:"+r1.totalMemory()+",剩余:"+r1.freeMemory());
        byte[]b=new byte[1024*1024*100];
        System.out.println("内存:"+r1.totalMemory()+",剩余:"+r1.freeMemory());

        Class s1=String.class;

        Class s2=RunTest.class;

        String str="java";
        Class s3=str.getClass();
        System.out.println(s1==s3);
        //double.class
        Class s4=Class.forName("java.lang.String");
        System.out.println(s3==s4);
        System.out.println("找到String 的父类:");
        System.out.println(s1.getSuperclass().getName());
        System.out.println("实现的接口:");
        Class fr[]=s1.getInterfaces();
        System.out.println(Arrays.toString(fr));
    }
}
